Skip to content

Learning examples: clean title, summary, reason and recent uses - #334

Merged
nambok merged 1 commit into
mainfrom
ui/examples-compact
Oct 27, 2026
Merged

nambok merged 1 commit into
mainfrom
ui/examples-compact

Conversation

@nambok

@nambok nambok commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

The Learning page's "Examples in use" listed each example's raw stored text: PR bodies and review comments with HTML comments (<!-- coderhelm:unverified -->), callout markers (> [!WARNING]), ## and **Summary** labels, "Source ticket" lines, cut mid-word. Examples now carry what a compact list and a detail panel need, and older ones are read the same way without a migration. The dashboard side is in CoderHelm/coderhelm (same branch name).

Changes

  • common::rewards::example_text (new): clean (markdown without HTML comments and tags, the unverified block, callout markers, Source ticket:/Closes #N lines), plain (no marks at all), title (PR title or comment heading, else the first sentence, cut at a word), summary (cleaned markdown, at most 600 characters, cut at a word, open code fence closed), legacy_split (old title: body text, keeping a commit type like fix(api): in the title and dropping a word cut when stored).
  • Exemplar gains title, summary, reason, run_id, last_used_at, used_by (latest 5 uses: reviewer + PR, or coding run). with_text builds title, summary and the prompt/embedding text from the GitHub title and body at store time; display() backfills title, summary and reason for examples stored before.
  • Reasons from outcomes: code changes from the PR's events ("CI passed on the first try, merged without changes", "CI needed 3 fix rounds, merged after people changed 40% of it", "Closed without merging"); review comments from the signal (acted on, dismissed after pushback, left open at close). Older examples get a reason from kind and polarity.
  • Worker: the fix, accepted-comment and dismissed-comment paths store through with_text with their reason; the fix keeps its run id. review_learning takes the PR number and coder_learning the run id, so count_exemplar_use records when and by what each example was used.
  • Prompts use the cleaned line too (title: plain summary), so agents no longer read HTML comments in examples.
  • GET /api/learning exemplars: adds title, summary, reason, events, run_id, last_used_at, used_by; text is now one clean line for older dashboards. Sorted by uses, then reward size; up to 200 (was 60, now that rows are small).

Verification

  • cargo fmt --check --all, cargo clippy --workspace -- -D warnings, cargo test --workspace (2446 passed).
  • New tests: markup and boilerplate removal, plain text, titles cut at a word, summaries with closed fences, legacy split (commit-type titles, mid-word cuts, no prefix), reasons, kept uses, store read-back of used_by, the summary JSON (clean fields, most used first, legacy backfill).

…sed them

Examples were kept as raw "title: body" text cut mid-word, so the Learning
page showed HTML comments, callout markers, section labels and "Source
ticket" lines. Each example now keeps a one-line title, a short cleaned
markdown summary, the reason it is an example (from its outcome: CI, merge,
close, acted on, dismissed, left open), the run that made it, and its last
five uses. Examples kept before this are read the same way on the fly.
@nambok
nambok merged commit 8c76ef1 into main Oct 27, 2026
8 checks passed
@nambok
nambok deleted the ui/examples-compact branch October 27, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant